package com.ihg.hiex.admin.dao.session;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.ihg.hiex.entity.session.Session;
import com.ihg.hiex.entity.session.before.finaltest.ExerciseType;
import com.ihg.hiex.entity.session.before.finaltest.FinalTest;
import com.ihg.hiex.entity.session.before.finaltest.FinalTestExercise;
import com.ihg.hiex.entity.user.Assessor;

/**
 *
 * @author Ark
 *
 */
@Dao("hibernate")
public interface FinalTestDao {
    
    /**
     * @param assessor
     * @return
     */
    @Query("FROM FinalTest WHERE disabled = false AND assessor = :assessor")
    public List<FinalTest> list(@Variable("assessor") Assessor assessor);
    
    /**
     * @param session
     * @return
     */
    @Query("FROM FinalTest WHERE disabled = false AND session = :session")
    public List<FinalTest> list(@Variable("session") Session session);

    /**
     * 
     * @param session
     * @param assessor
     * @param type
     * @return
     */
    @Query("FROM FinalTestExercise WHERE disabled = false AND session = :session AND assessor = :assessor AND type = :type")
    public List<FinalTestExercise> listExercise(@Variable("session") Session session, @Variable("assessor") Assessor assessor, @Variable("type") ExerciseType type);
    
    /**
     * 
     * @param session
     * @return
     */
    @Query("FROM FinalTestExercise WHERE disabled = false AND session = :session ORDER BY template.id")
    public List<FinalTestExercise> listExercise(@Variable("session") Session session);
    
}
